package com.practice.controller;
import com.alibaba.fastjson2.JSON;
import com.practice.entity.Account;
import com.practice.service.AccUserService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
/**
 * @program: tenghw-practice-demo
 * @author: tenghw
 * @create: 2024-01-15 22:26
 * @Version 1.0
 * @description:
 **/
@Slf4j
@RestController
public class AccountController {
    @Autowired
    AccUserService accUserService;
    @PostMapping(value = "/addAccount",consumes = {"application/json;charset=UTF-8"})
    public String addAccount(@RequestBody Account account){
        log.info("入参：{}", JSON.toJSONString(account));
        try {
            accUserService.addAccount(account);
            return "添加账户成功！";
        }catch (Exception e){
            return "error";
        }
    }
}